﻿using Inovout.Cloud.Applications.Models;
using Inovout.Cloud.Applications.Security.Models;
using Inovout.Services;
using NHibernate.Criterion;
using System.Collections.Generic;

namespace Inovout.Cloud.Applications.Services
{
    public class ApplicationService : RepositoryService<Application>, IApplicationService
    {
        public Application FindByName(string name)
        {
            return base.Repository.Find(Restrictions.Eq("Name", name).IgnoreCase());
        }
        public IEnumerable<Application> FindByOwner(string owner)
        {
            return base.Repository.FindAll(Restrictions.Eq("Owner", owner).IgnoreCase());
        }

        public override Application FindById(object id)
        {
            return base.Repository.FindById(id);
        }

     

        //public override void Create(Application entity)
        //{
        //    ApplicationUser appUser = new ApplicationUser();
        //    appUser.Name = entity.Name + "-appUser";
        //    entity.ApplicationUser = appUser;
        //    entity.Membership=

           
        //}
    }
}
